const request = require('../utils/requst');
const store = '/store/api';
const scope = 'store';
import { get } from '@utils/wxapi';
//扫码入座
class api {
  //扫码获取桌号
  static seated(data) {
    return request(store, { scope, cmdCode: 'MCH_DESK_GET', mchId: get('mchId'), source: JSON.stringify(data) });
  }
  //检验用户信息
  static userxx(data) {
    return request(store, { scope, cmdCode: 'STORE_MEMBER_POST', mchId: get('mchId'), source: JSON.stringify(data) });
  }
  //菜品分类信息
  static dishescla(data) {
    return request(store, { scope, cmdCode: 'GOODS_CAT_LIST', mchId: get('mchId'), source: JSON.stringify(data) });
  }
  //菜品详情
  static Dtlgoods(data) {
    return request(store, { scope, cmdCode: 'GOODS_GET', mchId: get('mchId'), source: JSON.stringify(data) });
  }
  //加入菜品购物车
  static addcaicrt(data) {
    return request(store, { scope, cmdCode: 'GOODS_CART_POST', mchId: get('mchId'), source: JSON.stringify(data) });
  }
  //购物车列表
  static cartList(data) {
    return request(store, { scope, cmdCode: 'GOODS_CART_LIST', mchId: get('mchId'), source: JSON.stringify(data) });
  }
  //删除购物车菜品
  static eletcai(data) {
    return request(store, { scope, cmdCode: 'GOODS_CART_DEL', mchId: get('mchId'), source: JSON.stringify(data) });
  }
  //编辑购物车数据
  static editcart(data) {
    return request(store, { scope, cmdCode: 'GOODS_CART_PATCH', mchId: get('mchId'), source: JSON.stringify(data) });
  }
  //下单
  static orders(data) {
    return request(store, { scope, cmdCode: 'ORDERS_POST', mchId: get('mchId'), source: JSON.stringify(data) });
  }
  //查看订单列表
  static orders_list(data) {
    return request(store, {
      scope,
      cmdCode: 'ORDERS_LIST',
      mchId: get('mchId'),
      pageIndex: data.page,
      pageSize: data.size,
      source: JSON.stringify(data.data),
    });
  }
  //查看订单
  static chaorders(data) {
    return request(store, { scope, cmdCode: 'ORDERS_GET', mchId: get('mchId'), source: JSON.stringify(data) });
  }
  //用户支付
  static userpay(data) {
    return request(store, { scope, cmdCode: 'PAY_PAYMENT_POST', mchId: get('mchId'), source: JSON.stringify(data) });
  }
  //查看积分记录
  static points(data) {
    return request(store, {
      scope,
      cmdCode: 'MEMBER_FINANCE_LOG_LIST',
      mchId: get('mchId'),
      pageIndex: data.page,
      pageSize: data.size,
    });
  }
  //加入vip
  static joinvip(data) {
    return request(store, { scope, cmdCode: 'MEMBER_JOIN', mchId: get('mchId'), source: JSON.stringify(data) });
  }
  //获取用户
  static getuser(data) {
    return request(store, { scope, cmdCode: 'MEMBER_GET', mchId: get('mchId'), source: JSON.stringify(data) });
  }
  //修改用户
  static putuser(data) {
    return request(store, { scope, cmdCode: 'MEMBER_PATCH', mchId: get('mchId'), source: JSON.stringify(data) });
  }
  //获取商户信息
  static getmch(data) {
    return request(store, { scope, cmdCode: 'MCH_GET', mchId: get('mchId'), source: JSON.stringify(data) });
  }
  //充值活动
  static payList(data) {
    return request(store, { scope, cmdCode: 'MKT_POINTS_LIST', mchId: get('mchId'), source: JSON.stringify(data) });
  }
  //充值活动详情
  static payGet(data) {
    return request(store, { scope, cmdCode: 'MKT_POINTS_GET', mchId: get('mchId'), source: JSON.stringify(data) });
  }
  //支付
  static pay(data) {
    return request(store, { scope, cmdCode: 'PAY_PAYMENT_POST', mchId: get('mchId'), source: JSON.stringify(data) });
  }
  //用户流水
  static payflowList(data) {
    return request(store, {
      scope,
      cmdCode: 'PAY_PAYMENT_LIST',
      mchId: get('mchId'),
      pageIndex: data.page,
      pageSize: data.size,
    });
  }
  //申请退款
  static payrefund(data) {
    return request(store, { scope, cmdCode: 'ORDERS_RETURN_POST', mchId: get('mchId'), source: JSON.stringify(data) });
  }
  //退款列表
  static payrefundList(data) {
    return request(store, {
      scope,
      cmdCode: 'ORDERS_RETURN_LIST',
      mchId: get('mchId'),
      pageIndex: data.page,
      pageSize: data.size,
      source: JSON.stringify(data.data),
    });
  }
  //获取用户手机号
  static phone(data) {
    return request(store, { scope, cmdCode: 'MEMBER_MOBILE_GET', mchId: get('mchId'), source: JSON.stringify(data) });
  }
}
module.exports = api;
